#include "temperature.h"

void temperature_start(){
  
  FILE* fd;

  fd = fopen("/mnt/1wire/28.5CDA81E3A43C/temperature", "r");

  size_t bl;
  char buf[64];

  struct bcshm_t shm;
  bcshm_open(&shm);
  
  while(1){
    bl = fread(buf, sizeof(buf), 1, fd);

    printf("%s\n", buf);
    bc_tlm_t bc_tlm;
    bc_tlm.temperature = atof(buf);
    bcshm_write(SHM_BC_TLM, &shm, &bc_tlm);

    sleep(5);
  }
}
